

<cfif isdefined("session.ReceiptNum")>
<CFQUERY NAME="getorders" DATASOURCE="#dsn#">
select *
from tblorders
where ReceiptNum = #session.ReceiptNum#
</CFQUERY>

<CFQUERY NAME="getitems" DATASOURCE="#dsn#">
select *
from tbltransactions, tblproducts
where ReceiptNum = #session.ReceiptNum# and tbltransactions.ProdID = tblproducts.ProdID
</CFQUERY>

<CFQUERY NAME="getitemssum" DATASOURCE="#dsn#">
select sum(Price) as total
from tbltransactions
where ReceiptNum = #session.ReceiptNum#
</CFQUERY>

</cfif>

<!---<cfif isdefined("form.amountpaid")>
<cfset mychange = #form.amountpaid# - #form.Amount#>
<cfif #form.amountpaid# lt #form.Amount#>
<cfset myblance = #mychange#>
<cfelse>
<cfset myblance = 0>

</cfif>
<cfset today = dateformat(now(), "mm/dd/yyyy")>
<cfset mytime = timeformat(now(), "hh:mm:ss tt")>


<CFQUERY DATASOURCE="#dsn#">
update tblorders
set Cash = #amount#,
Change = #mychange#,
TransType = 'POS',
LastFour = #session.pin#


where ReceiptNum = #session.ReceiptNum#
</CFQUERY>


<CFQUERY DATASOURCE="#dsn#">
INSERT INTO tblpayments (Amount, ReceiptNum, TransDate, ReportTime, ReportDate, PaymentType, PIN, Change, username, amountpaid, Balance)
VALUES (
#Amount#,
#session.ReceiptNum#,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#today#">,
'#mytime#',
'#today#',
'CASH',
#session.pin#,
#mychange#,
'#session.username#',
#amountpaid#,
<cfif #myblance# gte 1>#myblance#<cfelse>0</cfif>
 
)
</CFQUERY>--->



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: #FFFFFF;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #000000;
}
.style1 {
	font-size: 18px;
	font-weight: bold;
}
.style2 {
	font-size: 18px;
	font-weight: bold;
	color:#666666;
}
-->
</style></head>

<body onLoad="document.frm1.cc.focus()"><cfoutput>
      <table width="100%" border="0" cellspacing="2" cellpadding="2" height="374">
        <tr>
          <td width="41%"><strong class="style1">Credit Card Payment</strong></td>
          <td width="59%">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><hr size="1" noshade="noshade" /></td>
        </tr>
        <cfif not isdefined("form.amountpaid")><tr>
          <td class="style1">Total Amount</td>
          <td align="center" class="style11"><label class="style1">
            #lscurrencyformat(getitemssum.total)#
          </label></td>
        </tr></cfif>
        <tr>
          <td height="36" class="style1"><cfif isdefined("url.response")>#url.response#<cfelse><cfform method="post" action="par_cc_card.cfm" name="frm1" onsubmit="return ray.ajax()"><table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td height="35" class="style1">INSERT CARD NOW</td>
  </tr>
  <tr>
    <td class="style11">
    <input name="cc" type="password" class="style2" id="text1" onchange="formSubmit()" style="background-image:url(../images/fieldbg.png)" /><input name="amount" type="hidden" value="#getitemssum.total#" />  </td>
  </tr>
</table></cfform></cfif></td>
          <td rowspan="3" align="center" valign="top"><br />
            <br />
          <img src="../images/cards.png" width="263" height="50" /></td>
        </tr>
        <tr>
          <td height="36" class="style11">&nbsp;</td>
        </tr>
        <tr>
          <td height="67"><label>
            <cfif not isdefined("form.amountpaid") and not isdefined("url.response")><cfelse>
              <a href="../paperreceipt.cfm"><img src="../images/sm_print.png" border="0" /></a><a href="../killsession.cfm" target="_parent"><img src="../images/noreceipt.png" border="0" /></a>
            </cfif>
          </label></td>
        </tr>
      </table>
   </cfoutput>
    </td>
    </tr>
</table>
</body>
</html>
